package com.study.algorithm.linkList;/** * 逆置单链表  *比如：abcde-->edcba*/public class ReverseLinkList {    public static void reverseLinkList(LinkNode head){        LinkNode prev = null;        LinkNode cur = head;        LinkNode next = head.getNext();        while(next!=null){            cur.setNext(prev);            prev = cur;            cur = next;            next = next.getNext();        }        if (next==null){            cur.setNext(prev);        }        while(cur!=null){            System.out.print(cur);            cur = cur.getNext();        }    }    public static void main(String[] args) {        LinkNode a = new LinkNode("a") ;        LinkNode b = new LinkNode("b") ;        LinkNode c = new LinkNode("c") ;        LinkNode d = new LinkNode("d") ;        LinkNode e = new LinkNode("e") ;        a.setNext(b);        b.setNext(c);        c.setNext(d);        d.setNext(e);        reverseLinkList(a);    }}